package com.dxy.df.utils;

import com.dxy.df.core.exception.BizBizException;
import org.springframework.http.HttpStatus;
import org.springframework.util.StringUtils;

/**
 * 数据校验
 *
 * @author admin
 * @date 2017-12-23 15:50
 */
public class AssertUtil {

    private AssertUtil() {
    }

    public static void isBlank(String str, String message) {
        if (StringUtils.isEmpty(str)) {
            throw new BizBizException(message + " can not be empty ", HttpStatus.BAD_REQUEST.value());
        }
    }

    public static void isNull(Object object, String message) {
        if (object == null) {
            throw new BizBizException(message + " can not be null", HttpStatus.BAD_REQUEST.value());
        }
    }

}
